home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98c.txt
/
000078_icon-group-sender _Fri Nov 13 16:45:14 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) with SMTP id QAA04587
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Fri, 13 Nov 1998 16:45:13 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA07478; Fri, 13 Nov 1998 16:45:13 -0700
Date: Fri, 13 Nov 1998 13:26:24 -0700
From: swampler@noao.edu (Steve Wampler)
Subject: Re: Coding multi-part patterns, as in SNOBOL
To: icon-group@optima.CS.Arizona.EDU
Message-Id: <swampler-9810132026.AA006410162@orpheus.gemini.edu>
In-Reply-To: <Pine.LNX.3.95.981113120727.7576B-100000@smarty.smart.net>
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Mark Laster wrote:
> One of my programs in ICON processes e-mail messages. It does
> more than the snippet shown here, but for purposes of
> discussion, it removes the "e-mail quotation" marks from lines of
> text. As you know, those marks in aggregate may be either:
>
> (1) one or more angle brackets, starting at the left margin, or
>
> (2) one or more spaces, starting at the left margin, FOLLOWED
> IMMEDIATELY BY one or more angle brackets.
>
> To remove these "e-mail quote" marks, I needed about 20 lines,
> as shown below.
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> To perform the same operation in SNOBOL requires two lines (if
> that many):
>
> ...
> qupat = pos(0) (span(" ") | null) span(">") rem . rec
> ...
> strip rec qupat :s(strip)
> ...
> end
>
I haven't had a chance to test this (busy, busy), but something like
the following should work in Icon (note how it's capitalized):
procedure strip(s)
while s ?:= (tab(many('> ')), tab(0))
return s
end
This is even shorter than the SNOBOL you gave, but you can do something
similar in SNOBOL, also.
--
Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)]
The gods that smiled at your birth are now laughing openly. (Fortune Cookie)